home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / uw_1.exe / UW_HELP5.HLP < prev    next >
Text File  |  1992-11-03  |  31KB  |  733 lines

  1. `co(4,7);────────────────────────── /// General Macros ────────────────────────────────`co();
  2.     UltraWin also makes extensive use of macros ( defined in UW.H ) for simple
  3.     operations that do not justify the overhead of a function, and make your
  4.     programs more readable.  The following are for general use.
  5.  
  6. `co(10,1);/// hibyte`co();
  7.     #define hibyte(c)              (uchar) ((c) >> 8)
  8.     Yields the most significant byte of integer c.
  9.  
  10. `co(10,1);/// lobyte`co();
  11.     #define lobyte(c)              (uchar) ((c) & 0x00ff)
  12.     Yields the least significant byte of integer c.
  13.  
  14. `co(10,1);/// lower`co();
  15.     #define lower (x, y)         (x < y) ? x : y
  16.     Yields the lesser of the values x and y.
  17.  
  18. `co(10,1);/// range`co();
  19.     #define range(l,b,h)         ((((b) >= (l)) && ((b) <= (h))))
  20.     Yields a 1 if b is between l and h inclusive.
  21.  
  22. `co(10,1);/// swap`co();
  23.     #define swap(a,b,c)          ((c) = (a), (a) = (b), (b) = (c))
  24.     Swaps the values a and b utilizing a temporary c.
  25.  
  26. `co(10,1);/// upper`co();
  27.     #define upper (x, y)         (x > y) ? x : y
  28.   Yields the greater of the values x and y.
  29.  
  30. `co(4,7);────────────────────────── /// Window Macros ─────────────────────────────────`co();
  31.     Many of the things you do with windows are only accomplished with the
  32.     window macros.  The macros will allow you to perform several forms of
  33.     input/output to a window, change the window attributes, move the window
  34.     cursor within the window, and more.  Nearly every access performed on
  35.     a window structure can be done using these macros.  We recommend the use
  36.     of these macros wherever possible as it allows us to "hide" the data
  37.     structure, a common OOP technique. A close look at these macros will
  38.     give you some insight into how UltraWin uses the window structure.
  39.  
  40. `co(10,1);/// cls`co();
  41.     #define cls()                                 (setmem(Screen, V_cols * V_rows * 2, 0))
  42.     Clears the entire screen to black.
  43.  
  44. `co(10,1);/// mv_cs`co();
  45.     #define mv_cs(c,r,wnp)                ((wnp)->csr_x = (c), (wnp)->csr_y = (r))
  46.     Moves the "soft" cursor in window wnp to the column and row c and r.
  47.     
  48. `co(10,1);/// wn_att`co();
  49.     #define wn_att(a,wnp)                 ((wnp)->att = (a))
  50.     Sets the window attribute in wnp to the value a.
  51.  
  52. `co(10,1);/// wn_bdratt`co();
  53.     #define wn_bdratt(a,wnp)            ((wnp)->bdr_att = (a))
  54.     Sets the window border attribute in wnp to the value a.    This is
  55.     the complement to the wn_att macro.
  56.     
  57. `co(10,1);/// wn_bdr_color`co();
  58.     #define wn_bdr_color(f,b,wnp) ((wnp)->bdr_att = ((b) << 4) | (f))
  59.     Sets the border foreground and background colors in window wnp.  This
  60.     is the complement to the wn_color macro.
  61.  
  62. `co(10,1);/// wn_color`co();
  63.     #define wn_color(f,b,wnp)         ((wnp)->att = ((b) << 4) | (f))
  64.     Sets the foreground and background colors in window wnp.    This is
  65.     done by setting the window attribute accordingly.
  66.     
  67. `co(10,1);/// wn_name`co();
  68.     #define wn_name(n, wnp)             ((wnp)->name = (n))
  69.     Sets the name at the top of window wnp to the string n.
  70.  
  71. `co(10,1);/// wn_name_loc`co();
  72.     #define wn_name_loc(l, wnp)     ((wnp)->name_loc = (l))
  73.     Sets the location of the name in window wnp to left, right, or
  74.     centered.
  75.  
  76. `co(10,1);/// wn_read`co();
  77.     #define wn_read( wnp )                (wn_io( IN, BUFF, (wnp)))
  78.     Pulls what is actually on the screen under the window into the
  79.     window itself!    This is like wn_save, but instead of pulling the
  80.     area under the window into the save/restore buffer, it pulls it
  81.     into the window.
  82.  
  83. `co(10,1);/// wn_restore`co();
  84.     #define wn_restore( wnp )         (wn_io(OUT, SAVE, (wnp)))
  85.     Restores the area saved (by the macro wn_save) under the window wnp.
  86.     
  87. `co(10,1);/// wn_rfsh`co();
  88.     #define wn_rfsh( wnp )                (wn_io(OUT, BUFF, (wnp)))
  89.     Redraws (refreshes) the window wnp. 
  90.  
  91. `co(10,1);/// wn_save`co();
  92.     #define wn_save( wnp )                (wn_io( IN, SAVE, (wnp)))
  93.     Saves the area under the window wnp to the window save area for later
  94.     restoration.
  95.  
  96. `co(10,1);/// wn_get_att`co();
  97.   #define wn_get_att(wnp)                 ((wnp)->att)
  98.   Returns the current window attribute. (See wn_att to set).
  99. `co(10,1);/// wn_get_bdratt`co();
  100.     #define wn_get_bdratt(wnp)             ((wnp)->bdr_att)
  101.   Returns the current window border attribute. (See wn_bdratt to set).
  102.  
  103. `co(10,1);/// wn_get_bdr_style`co();
  104.     #define wn_get_bdr_style(wnp)         ((wnp)->bdr_style)
  105.   Returns the current window border style. (SGL_BDR,DBL_BDR,SLD_BDR,DUAL_BDR)
  106. `co(10,1);/// wn_set_bdr_style`co();
  107.     #define wn_set_bdr_style(state,wnp)      ((wnp)->bdr_style = state)
  108.     Sets the window border style.  You must call wn_border to redraw.
  109.  
  110. `co(10,1);/// wn_get_cols`co();
  111.     #define wn_get_cols(wnp)               ((wnp)->cols)
  112.   Returns the number of columns in the window, counting any border.
  113.   NOTE: There is no set macro as the columns cannot be changed directly.
  114.  
  115. `co(10,1);/// wn_get_csr_x`co();
  116.     #define wn_get_csr_x(wnp)           ((wnp)->csr_x)
  117.   Returns the window's current cursor x position.
  118. `co(10,1);/// wn_set_csr_x`co();
  119.     #define wn_set_csr_x(x,wnp)           ((wnp)->csr_x = x)
  120.   Sets the window's current cursor x position.
  121.  
  122. `co(10,1);/// wn_get_csr_y`co();
  123.     #define wn_get_csr_y(wnp)           ((wnp)->csr_y)
  124.   Returns the window's current cursor y position.
  125. `co(10,1);/// wn_set_csr_y`co();
  126.     #define wn_set_csr_y(y,wnp)           ((wnp)->csr_y = y)
  127.   Sets the window's current cursor y position.
  128.  
  129. `co(10,1);/// wn_get_name_loc`co();
  130.     #define wn_get_name_loc(wnp)           ((wnp)->name_loc)
  131.   Returns the window's current name location. (CENTERED,LEFT_JUST,RIGHT_JUST)
  132. `co(10,1);/// wn_set_name_loc`co();
  133.     #define wn_set_name_loc(state,wnp)        ((wnp)->name_loc = state)
  134.   Sets the window's name location.  Call wn_border to redraw.
  135.  
  136. `co(10,1);/// wn_get_rows`co();
  137.     #define wn_get_rows(wnp)                 ((wnp)->rows)
  138.   Returns the number of rows in the window, counting any border.
  139.   NOTE: There is no set macro as the rows cannot be changed directly.
  140.  
  141. `co(10,1);/// wn_is_bell_flag`co();
  142.     #define wn_is_bell_flag(wnp)        ((wnp)->bell_flag)  
  143.   Returns the state of the bell process flag.  If wn_st_fmt() is used, and
  144.   this bit is set, a tone is sounded when a bell character is encountered.
  145. `co(10,1);/// wn_set_bell_flag`co();
  146.     #define wn_set_bell_flag(state,wnp)    ((wnp)->bell_flag = state)
  147.     Sets the state of the bell flag.
  148.  
  149. `co(10,1);/// wn_is_bk_flag`co();
  150.     #define wn_is_bk_flag(wnp)          ((wnp)->bk_flag)    
  151.   Returns the state of the backspace process flag.  If wn_st_fmt() is used,
  152.   and this bit is set, a backspace will cause the cursor to move back one
  153.   space and delete the character.
  154. `co(10,1);/// wn_set_bk_flag`co();
  155.     #define wn_set_bk_flag(state,wnp)      ((wnp)->bk_flag = state)
  156.     Sets the state of backspace flag.
  157.  
  158. `co(10,1);/// wn_is_bs_clear`co();
  159.     #define wn_is_bs_clear(wnp)         ((wnp)->bs_clear)   
  160.     Returns the state of the backspace clear flag.  This is used by the 
  161.     function `keyword(wn_bksp,[uw_help2.hlp]/// wn_bksp); in uw_term.c and is used for terminal emulation support.
  162.     If set, a backspace will clear the previous character, otherwise, it will
  163.     simply move back one character, leaving the character unchanged.
  164. `co(10,1);/// wn_set_bs_clear`co();
  165.     #define wn_set_bs_clear(state,wnp)     ((wnp)->bs_clear = state)
  166.     Sets the state of the backspace clear flag.
  167.  
  168. `co(10,1);/// wn_is_cr_flag`co();
  169.     #define wn_is_cr_flag(wnp)          ((wnp)->cr_flag)    
  170.   Returns the state of the carriage return flag.  If wn_st_fmt() is used,
  171.   and this bit is set, a carriage return will cause the cursor to move to
  172.   the first column of the current row. NOTE: The cursor is not moved
  173.   to the next row.  (See wn_is_lf_flag).
  174. `co(10,1);/// wn_set_cr_flag`co();
  175.     #define wn_set_cr_flag(state,wnp)      ((wnp)->cr_flag = state)
  176.   Sets the state of the carriage return flag.
  177.  
  178. `co(10,1);/// wn_is_cr_lf_flag`co();
  179.     #define wn_is_cr_lf_flag(wnp)       ((wnp)->cr_lf_flag) 
  180.   Returns the state of the carriage return/line feed flag.  If wn_st_fmt()
  181.   is used, and this bit is set, a carriage return OR line feed will cause
  182.   the cursor to move to the first column of the next line.
  183. `co(10,1);/// wn_set_cr_lf_flag`co();
  184.     #define wn_set_cr_lf_flag(state,wnp)   ((wnp)->cr_lf_flag = state)
  185.   Sets the state of t